﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;

namespace ECP.Service.Utilities
{
    public class WCFClientBase<T> : IDisposable
    {

        private ChannelFactory<T> channelFactory;
        protected T wcfService;

        public WCFClientBase(string endpointName)
        {
            channelFactory = new ChannelFactory<T>(endpointName);
            wcfService = channelFactory.CreateChannel();

        }


        public void Dispose()
        {
            if (channelFactory != null)
            {
                try
                {
                    channelFactory.Close();
                }
                catch
                {
                    channelFactory.Abort();
                }
            }


        }


    }
}
